		<{include file="validate.tpl"}>
		<script typpe="text/javascript" src="<{'static/js/jquery.uniform.js'|url}>"></script>
		<link rel="stylesheet" href="<{'static/css/uniform.css'|url}>" />
		<script typpe="text/javascript" src="<{'static/js/select2/select2.min.js'|url}>"></script>
		<link rel="stylesheet" href="<{'static/js/select2/select2.css'|url}>" />
		<link rel="stylesheet" href="<{'static/js/select2/select2-bootstrap.css'|url}>" />
		<link rel="stylesheet" href="<{'static/css/page.css'|url}>" />
		<script type="text/javascript">
		(function($){
		$().ready(function(){
			//載入select2的中文語言包
			$.extend($.fn.select2.defaults, {
				formatNoMatches: function () { return "沒有找到匹配項"; },
				formatInputTooShort: function (input, min) { var n = min - input.length; return "請再輸入" + n + "個字符";},
				formatInputTooLong: function (input, max) { var n = input.length - max; return "請刪掉" + n + "個字符";},
				formatSelectionTooBig: function (limit) { return "你只能選擇最多" + limit + "項"; },
				formatLoadMore: function (pageNumber) { return "加載結果中..."; },
				formatSearching: function () { return "搜索中..."; }
			});
			//全部控件使用皮膚
			$('input[type=checkbox],input[type=radio],input[type=file]','form:not([notheme]),table:not([notheme])').uniform();
			$('select:not([notheme])').select2();

			//給validator設置默認值
			$.validator.setDefaults({
				errorClass: "help-inline",
				errorElement: "span",
				highlight:function(element, errorClass, validClass) {
					$(element).parents('.control-group').removeClass('success').addClass('error');
				},
				unhighlight: function(element, errorClass, validClass) {
					$(element).parents('.control-group').removeClass('error').addClass('success');
				},
				errorPlacement: function(error, element) {  
					if (element.is(':checkbox,:radio')) {
						error.appendTo(element.closest('.controls'));  
					} else {
						error.insertAfter(element);
					}
				    
				},
				submitHandler:function(form){
					var $form = $(form);
					$.query($form.attr('action'), $form.serialize(), $form.attr('method'), function(json) {
						$form.triggerHandler('query', [json, form]);
					});
					return false;
					//form.submit();
				}
			});
			$.fn.__checkAll = $.fn.checkAll;
			$.fn.extend({
				checkAll : function($selector){
					return this.__checkAll($selector, function(checked, indeterminate){
						this.each(function(){
							var o = $(this).closest('.checker > span');
							if (this.checked)
								o.addClass('checked');
							else
								o.removeClass("checked");
						});
					});
				}, order_by : function(url, _order_by) {
					return this.each(function(){
						var $this= $(this);
						var field = $this.attr('order_by');
						if (_order_by['list'][field])
						{
							url = url.replace(/&?order_by(\[|%5B)[^=]*(\]|%5D)=(asc|desc)/ig,'');
							var html = '<a href="'+ url + (url.indexOf('?') >=0 ? '&' : '?') +'order_by['+ field +']=' + _order_by['list'][field] + '">' + $this.html();
							if (_order_by['original'][field] && _order_by['original'][field] == 'ASC')
								html += ' <i class="icon-chevron-up"></i>';
							if (_order_by['original'][field] && _order_by['original'][field] == 'DESC')
								html += ' <i class="icon-chevron-down"></i>';
							html += '</a>'
							$this.html(html);					
						}
					});
				}, parse_form_val : function(form) {
					return this.each(function(){
						var t = $(this);
						var val = t.val().split(',');
						var name = t.attr('name');
						if (val.length > 0)
						{
							for (var i = 0; i < val.length; i++) {
								if (val[i] != '')
									$('<input type="hidden" name="'+name+'" value="'+ val[i] +'"/>').appendTo(form);
							};
						};
						t.remove();
					});
				}
			});
			$.kindeditor_default_setting = {
				allowFileManager : false,
				allowFileUpload: false,
				//readonlyMode : true,
				items : [
					'bold',	'italic', 'underline','strikethrough','|','cut', 'copy', 'paste',
					'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
					'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
					'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'source','preview', 'fullscreen', 
					'/',
					'formatblock', 'fontname', 'fontsize', 'forecolor', 'hilitecolor', '|' , 'undo', 'redo', '|',  'lineheight', 'removeformat', '|', 'image', 'multiimage',
					'flash', 'table', 'hr', 'emoticons', '|', 
					'anchor', 'link', 'unlink','|','baidumap'
				],
				urlType : 'domain',
				formatUploadUrl : false,
				extraFileUploadParams : {
				   "PHPSESSID" : "<{''|@session_id|encrypt}>"
				},
				uploadJson : '<{'attachment/kindeditor_upload_query?of=json'|url}>',
				filePostName : 'Filedata'
			};
			$.ueditor_default_setting = {
				simple: {toolbars: [
					['fullscreen', 'source', '|', 'undo', 'redo', '|', 'drafts', 'pasteplain', 'selectall', 'cleardoc', '|', 'print', 'preview', 'searchreplace', '|', 'removeformat', 'formatmatch', 'autotypeset', '|', 'directionalityltr', 'directionalityrtl', '|',  'help'],
					['bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'forecolor', 'backcolor', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', 'indent','|', 'rowspacingtop', 'rowspacingbottom', 'lineheight', '|', 'superscript', 'subscript', '|', 'touppercase', 'tolowercase'],
					['customstyle', 'paragraph', 'fontfamily', 'fontsize', '|', 'template', '|', 'insertorderedlist', 'insertunorderedlist', '|', 'link', 'unlink', 'anchor', '|', 'blockquote',/*'insertcode',*/ 'pagebreak', 'horizontal', '|', 'simpleupload', 'insertimage']
				]},complete: {toolbars: typeof window.UEDITOR_CONFIG != 'undefined' ? window.UEDITOR_CONFIG.toolbars : []
				}
			};	
		});
		})(jQuery);
		</script>
		<script src="<{'static/js/jquery.input.placeholder.js'|url}>"></script>
